#include "ZState.h"

ZState::ZState(int init_state, QObject *parent) :
    QObject(parent),
    m_old_state(init_state),
    m_current_state(init_state)
{

}

void ZState::setCurrentState(int state)
{
    if (state != m_current_state)
    {
        m_old_state = m_current_state;
        m_current_state = state;
        emit sigStateChanged(m_old_state, m_current_state);
    }
}

int ZState::currentState()
{
    return m_current_state;
}

int ZState::lastState()
{
    return m_old_state;
}

bool ZState::testCurrentState(int state)
{
    return m_current_state == state;
}
